<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>电商</title>
</head>
<link rel="stylesheet" type="text/css" href="/tpshop2/Public/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/tpshop2/Public/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="/tpshop2/Public/css/nivo-slider.css">
<link rel="stylesheet" type="text/css" href="/tpshop2/Public/css/front.css">
<body id="product_detail">
	<div class="container">
		<div class="row" id="header">
			<div class="col-md-3">
			<a href="<?php echo U()?>"><img  class="logo" src="/tpshop2/Public/img/logo.jpg"></a>
			</div>
			<div class="col-md-6">
					<p id="contact"><i class="glyphicon glyphicon-phone-alt"></i>400-12345678910<i class="glyphicon glyphicon-envelope"></i>shop@goodjobs.cn</p>
				 <div class="input-group">
			      <input type="text" class="form-control" placeholder="请输入商品名称或编号...">
			      <span class="input-group-btn">
			        <button class="btn btn-info" type="button">搜索</button>
			      </span>
			    </div>
			</div>
			<div class="col-md-3 user_header">
				<?php if($_SESSION['user_is_login']){?>
					<span>欢迎你，<?=$_SESSION['user_name']?></span><a href="<?=U("user/logout");?>">退出</a>
				<?php }else{?>
				<a href="<?=U('user/login')?>">请登录</a>
				<a href="<?=U('user/regedit')?>">请注册</a>
				<?php }?>
				<a href="<?=U('Shopping/cartList');?>" class="shopcart pull-right">
				
					<i class=" glyphicon glyphicon-shopping-cart "></i>我的购物车
					<?php if($_SESSION['user_is_login']){?>
					<span>2322</span>
					<?php }?>
				</a>
			</div>
		</div>     
        <div class="row">
        <div class="col-md-6">
            <div id="product_imgs">
                <img  id="product_main_img" src="/tpshop2<?=$product['img']?>" data-zoom-image="/tpshop2<?=$product['img']?>"/>
                <ul>
                    <?php foreach($imgs as $i){?>
                    <li><img src="/tpshop2<?=$i['url']?>"></li>
                    <?php }?>
                </ul>
            </div>
        </div>
         <div class="col-md-6">
            <div id="product_main">
             <h3><?=$product['title']?></h3>
             <table class="product_arg">
               <tr>
                 <td class="l">价格:</td>
                 <td class="price">￥<?=$product['price']?></td>
               </tr>
               <tr>
                 <td class="l">商品评分</td>
                 <td class="star">
                 <?php for($i=0;$i<5;$i++){?>
                    <?php if($i<$product['star']){?>
                    <i class="glyphicon glyphicon-star"></i>
                    <?php } else{?>
                         <i class="glyphicon glyphicon-star-empty"></i>
                    <?php }?>
                <?php }?>

                 </td>
               </tr>
               <tr>
                 <td class="l">运费:</td>
                 <td class="deliver_fee">满99免运费</td>
               </tr>
               <form action="<?=U('Shopping/addToCart')?>" method="post" >
               <input type="hidden" name="product_id" value="<?=$product->id?>">
               <tr>
                 <td class="l">购买数量</td>
                 <td class="num">
                   <span class="minus">-</span><input name="num" type="text" class="n" value="1" /><span class="add">+</span>
                 </td>
               </tr>
               <tr>
                 <td class="l">送货:</td>
                 <td class="deliver">            由仓库全国最近点发货，并提供售后服务。如有问题咨询在线客服~!上午08:30前完成下单下午送达,下午下单隔日第二天送达</td>
               </tr>
             </table>
             <a href="#" class="btn btn-success btn-lg">立即购买</a>
             <button type="submit" href="#" class="btn btn-danger btn-lg">加入购物车</button>
             </form>
           </div>
         </div>
        </div>
      </div>
	<script type="text/javascript" src="/tpshop2/Public/js/jquery.js"></script>
  <script type="text/javascript" src="/tpshop2/Public/js/jquery.elevateZoom-3.0.8.min.js"></script>
	<script type="text/javascript">
      $(function() {
        $('#product_imgs ul li ').mouseover(function(){
          $('#product_imgs ul li ').removeClass('hover');
          $(this).addClass('hover');
          var src = $(this).find('img').attr('src');
          $('#product_main_img').attr('src',src);
        });

        $('.num .add').click(function(){
            var n= $(".num .n").val();
            n=parseInt(n)+1;
            $(".num .n").val(n);
        });
         $('.num .minus').click(function(){
            var n= $('.num .n').val();
            n=parseInt(n)-1;
            if(n>0){
            $('.num .n').val(n);
          }
        });
         $('#product_main_img').elevateZoom({
            zoomType:"inner",
            zoomWindowWidth:100,
            zoomWindowHeight:100
          });
      })
  </script>
</body>
</html>